# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: gmes78 <gmes.078 at gmail dot com>

pkgname=python-qasync
pkgver=0.24.0
pkgrel=1
pkgdesc="Python library for using asyncio in Qt-based applications"
arch=(any)
url="https://github.com/CabbageDevelopment/qasync"
license=('BSD')
depends=('python')
optdepends=('pyside2' 'pyside6' 'python-pyqt5' 'python-pyqt6')
makedepends=('python-setuptools')
checkdepends=('python-pytest-raises' 'pyside2' 'pyside6' 'python-pyqt5' 'python-pyqt6'
              'xorg-server-xvfb')
source=("https://github.com/CabbageDevelopment/qasync/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('a370f2417abdf4257c1fb5df7dc92c13b504c2206a574012ae4d176968d5133b98480bbd26a441cb8bc02df51981093abe5f5586e002ed665fb1d5814f8f0327')

build() {
  cd qasync-$pkgver
  python setup.py build
}

check() {
  cd qasync-$pkgver
  QT_API=pyside2 xvfb-run python -m pytest
  QT_API=pyside6 xvfb-run python -m pytest
  QT_API=pyqt5 xvfb-run python -m pytest
  QT_API=pyqt6 xvfb-run python -m pytest
}

package() {
  cd qasync-$pkgver
  python setup.py install --root="$pkgdir/" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
